class Demo:
    def __str__(self):
        return '姓名{},年龄{}'.format(self.age,self.name)

    # 限制动态绑定 子类没有声明则不影响
    __slots__ = ('name','age')


d = Demo()
d.name = 'tqq'  #动态绑定属性
d.age = '18'

print(d)

class DemonSon(Demo):
    __slots__ = ()
    pass

s = DemonSon()
s.age = '18'
print(s.age)
